﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Worktool.CODE_Chris.FileClasses;

namespace Worktool
{
    public partial class dbSelect : Form
    {
        string datenbank = "";
        
        public dbSelect()
        {
            InitializeComponent();
            button1.Enabled = false;
            //new GetXmlFile();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            datenbank = comboBox1.Text;
            button1.Enabled = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Login.connectionMASTER = "Data Source=" + Login.dictSettings["server"] + ";Initial Catalog=ASC_USER;Persist Security Info=True;User ID=asc;Password=Asc0001!";

            if (comboBox1.Text == "Quantum")
            {
                Login.connection = "Data Source="+Login.dictSettings["server"]+";Initial Catalog=ASC;Persist Security Info=True;User ID=asc;Password=Asc0001!";
                Login.currentDBName = "Quantum";
                //Properties.Settings.Default.CurrentConnectionString = Properties.Settings.Default.ASCConnectionString;
                //Properties.Settings.Default.CurrentDBName = "Quantum";
                //Properties.Settings.Default.Save();
                this.Close();

                
            }

            if (comboBox1.Text == "Hyperion")
            {
                Login.connection = "Data Source=" + Login.dictSettings["server"] + ";Initial Catalog=ASC_1;Persist Security Info=True;User ID=asc;Password=Asc0001!";
                Login.currentDBName = "Hyperion";
                //Properties.Settings.Default.CurrentConnectionString = Properties.Settings.Default.ASCConnectionString;
                //Properties.Settings.Default.CurrentDBName = "Quantum";
                //Properties.Settings.Default.Save();
                this.Close();


            }

            if (comboBox1.Text == "Anthem")
            {
                Login.connection = "Data Source=" + Login.dictSettings["server"] + ";Initial Catalog=ASC_2;Persist Security Info=True;User ID=asc;Password=Asc0001!";
                Login.currentDBName = "Anthem";
                //Properties.Settings.Default.CurrentConnectionString = Properties.Settings.Default.ASC_2ConnectionString;
                //Properties.Settings.Default.CurrentDBName = "Anthem";
                //Properties.Settings.Default.Save();
                this.Close();

                
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {

            System.Diagnostics.Process.GetCurrentProcess().Kill();
            Application.Exit();
        }
    }
}
